package com.joysuch.wwyt.workflow.entity;

import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * @Author ZhaoQiuWei
 * @Date 2021/8/18 13:22
 */

@Data
@Entity
@EntityListeners({AuditingEntityListener.class, AutoSetCommonFieldListener.class})
@Table(name = "wwyt_location_verify_record")
@SQLDelete(sql = "update wwyt_location_verify_record set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update wwyt_location_verify_record set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")
public class LocationVerifyRecord {

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @ApiModelProperty("主键ID")
    private Long id;

    @ApiModelProperty("请求记录号")
    private String requestId;

    @ApiModelProperty("组件Key")
    private String componentKey;

    @ApiModelProperty("组件名称")
    private String componentName;

    @ApiModelProperty("节点名称")
    private String taskName;

    @ApiModelProperty("人员id")
    private Long userId;

    @ApiModelProperty("用户类型0：内部员工，1：承包商")
    private String userContractorFlag;

    @ApiModelProperty("GPS经度")
    private Double longitude;

    @ApiModelProperty("GPS纬度")
    private Double latitude;

    @ApiModelProperty("楼层")
    private Integer floorId;

    @ApiModelProperty("签字时间")
    private Date verifyTime;

    @ApiModelProperty("业务编码")
    private String taskCode;

    @ApiModelProperty("0正常-在区域内,1异常-不在区域内,2不在区域,3没有最近一次轨迹,4 sn为空")
    private Integer verifyState;

    @org.springframework.data.annotation.CreatedBy
    @ApiModelProperty("创建人")
    private Long createBy;

    @org.springframework.data.annotation.CreatedDate
    @ApiModelProperty("创建时间")
    private Date createTime;

    @org.springframework.data.annotation.LastModifiedBy
    @ApiModelProperty("更新人")
    private Long updateBy;

    @org.springframework.data.annotation.LastModifiedDate
    @ApiModelProperty("更新时间")
    private Date updateTime;

    @ApiModelProperty("租户")
    private Long tenentId;

    @ApiModelProperty("组织机构代码")
    private String orgCode;

    @ApiModelProperty("删除标记")
    private String deleteFlag;

    @ApiModelProperty("分组id")
    private String groupId;

    @ApiModelProperty("新版本的作业票")
    private Boolean newWorkflow;

}
